package org.come.until;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.come.Jpanel.ZhuJpanel;
import org.come.MountShouHu.ShouhuPackJframe;
import org.come.bean.ConfigureBean;
import org.come.entity.Goodstable;
import org.come.entity.Mount;
import org.come.entity.MountSkill;
import org.come.entity.Pal;
import org.come.entity.RoleSummoning;
import org.come.model.Configure;
import org.come.model.PalData;

import com.gl.util.LingXiUtil;
import com.tool.btn.BaptizeBtn;
import com.tool.role.Ql;
import com.tool.role.QualityZW;
import com.tool.role.RoleData;
import com.tool.role.RoleProperty;
import org.come.mouslisten.PetAddPointMouslisten;

public class AccessNedanMsgUntil {
	private static Map<String, Double> map;
	/***/
	public static void addMapValue(Map<String, Double> map,String key,double value){
		if (value==0) {
			return;
		}
		Double mapValue=map.get(key);
		if (mapValue!=null) {
			value+=mapValue;
		}
		map.put(key, value);
	}
	public static double getMapValue(Map<String, Double> map,String key){
		Double mapValue=map.get(key);
		return mapValue!=null?mapValue:0;
	}
	/**ture属性计算  false 抗性计算*/
	public synchronized static Map<String, Double> getPalMap(Pal pal,boolean isV){
		if (map==null) {map=new HashMap<>();}
		else {map.clear();}
		PalData palData=UserMessUntil.getPalData(pal.getpId());
		if (palData==null) {
			return map;
		}
		Integer grade = RoleData.getRoleData().getLoginResult().getGrade();
		int lvl = AnalysisString.lvlint(grade);
		int zs = AnalysisString.lvltrue(grade);
		if (isV) {
			int[] jds=palData.getJds();
			int size=jds[0]+jds[1]+jds[2]+jds[3];
			int point=lvl+zs*40;//分配点数
			addMapValue(map,"根骨",lvl+point/size*palData.getJds()[0]);
			addMapValue(map,"灵性",lvl+point/size*palData.getJds()[1]);
			addMapValue(map,"力量",lvl+point/size*palData.getJds()[2]);
			addMapValue(map,"敏捷",lvl+point/size*palData.getJds()[3]);
			point=lvl%size;
			for (int i = 0; i <jds.length; i++) {
				if (point<=0) {
					break;
				}else if (jds[i]==0) {
					continue;
				}
				if (point>jds[i]) {
					addMapValue(map,i==0?"根骨":i==1?"灵性":i==2?"力量":"敏捷", palData.getJds()[i]);
					point-=palData.getJds()[i];
				}else {
					addMapValue(map,i==0?"根骨":i==1?"灵性":i==2?"力量":"敏捷", point);
					point=0;
				}
			}
		}else {
			if (palData.getKx()!=null&&!"".equals(palData.getKx())) {
				String[] v=palData.getKx().split("\\|");
				for (int i = 0; i < v.length; i++) {
					String[] vs=v[i].split("=");
					double value=Double.parseDouble(vs[1]);
					if (vs.length==3) {
						value+=Double.parseDouble(vs[2])*lvl;
					}
					addMapValue(map, vs[0], value);
				}
			}
		}
		if (pal.getParts()!=null&&!"".equals(pal.getParts())) {
			String[] v=pal.getParts().split("\\|");
			for (int i = 0; i < v.length; i++) {
				String[] vs=v[i].split("=");
				Goodstable good=GoodsListFromServerUntil.fushis.get(new BigDecimal(vs[1]));
				if (good!=null) {
					String[] vss=good.getValue().split("\\|");
					for (int j = 1; j < vss.length; j++) {
						if (vss[j].startsWith(BaptizeBtn.Extras[0])) {
							String[] vStrings = vss[j].split("\\&");
							for (int k = 1; k < vStrings.length; k++) {
								String[] mes = vStrings[k].split("=");
								addMapValue(map, mes[0], Double.parseDouble(mes[1]));
							}
						}else {
							String[] mes = vss[j].split("=");
							addMapValue(map, mes[0],RoleProperty.getdouble(mes[1]));
						}
					}
				}
			}
		}
		if (!isV) {
			Double value=map.remove("四抗");
			if (value!=null) {
				addMapValue(map, "抗混乱", value);
				addMapValue(map, "抗封印", value);
				addMapValue(map, "抗昏睡", value);
				addMapValue(map, "抗遗忘", value);
			}
			value=map.remove("抗仙法");
			if (value!=null) {
				addMapValue(map, "抗风", value);
				addMapValue(map, "抗火", value);
				addMapValue(map, "抗水", value);
				addMapValue(map, "抗雷", value);
			}
		}
		return map;
	}
	public synchronized static Ql getPalQl(Ql ql,Pal pal){
		if (ql==null) {ql=new Ql();}
		else {ql.Reset();}
		if (pal==null) {
			return ql;
		}
		PalData palData=UserMessUntil.getPalData(pal.getpId());
		if (palData==null) {
			return ql;
		}
		Map<String, Double> map=getPalMap(pal,false);
		for(Entry<String, Double> entry:map.entrySet()){
			QualityZW.insertValues(ql,entry.getKey(),entry.getValue());
		}
		return ql;
	}

	public synchronized static Ql getPetQl(Ql ql,RoleSummoning pet){

		ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
		Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
		Configure configure = item.get(new BigDecimal(1));




		if (ql==null) {ql=new Ql();}
		else {ql.Reset();}
		if (pet==null) {
			return ql;
		}
		//抗性上限过滤 
		int up = 75;
		if(configure.getZhskxsx()!=null && configure.getZhskxsx()!="") {
			up = up+Integer.parseInt(configure.getZhskxsx());
		}
		try {
			if (pet.getStye()!=null&&pet.getStye().length()>1) {
				String[] v=pet.getStye().split("\\|");
				for (int i = 1; i < v.length; i++) {
					String[] vs=v[i].split("-");
					if (vs.length>=2) {
						Goodstable goodstable=GoodsListFromServerUntil.fushis.get(new BigDecimal(vs[1]));
						if (goodstable!=null&&goodstable.getType()!=729) {
							String[] t=goodstable.getValue().split("\\|");
							for (int j = 6; j < t.length; j++) {
								if (t[j].startsWith("炼化属性")) {
									String[] vStrings = t[j].split("\\&");
									for (int k = 1; k < vStrings.length; k++) {
										String[] mes = vStrings[k].split("=");
										if (!mes[0].endsWith("等级")) {
											QualityZW.insertValues(ql, mes[0],Double.parseDouble(mes[1]));
										}
									}
								}
							}
						}
					}
				}
			}
			//天生抗性
			if (pet.getResistance()!=null&&!"".equals(pet.getResistance())) {
				String[] v=pet.getResistance().split("\\|");
//				if (v.length>=3) {JmSum.xiugaiqi();return ql;}
				for (int i=0;i<v.length;i++) {
					String[] v1=v[i].split("=");
					double value=Double.parseDouble(v1[1]);
//					if (value!=30) {JmSum.xiugaiqi();return ql;}//防修改
					QualityZW.insertValues(ql,v1[0],value);
				}
			}
			//坐骑属性
			for (int i = 0; i < ZhuJpanel.getListMount().size(); i++) {
				Mount mount=ZhuJpanel.getListMount().get(i);
				if(mount.isID(pet.getSid())){
					up+=20;
					inster(ql,"狂暴率", (Double) PetAddPointMouslisten.value("狂暴率",mount.getMountid())[1]);
					inster(ql,"命中率", (Double) PetAddPointMouslisten.value("命中率",mount.getMountid())[1]);
					inster(ql,"抗致命率", (Double) PetAddPointMouslisten.value("抗致命率",mount.getMountid())[1]);
					inster(ql,"抗风法狂暴", (Double) PetAddPointMouslisten.value("抗仙法鬼火狂暴几率",mount.getMountid())[1]);
					inster(ql,"抗火法狂暴", (Double) PetAddPointMouslisten.value("抗仙法鬼火狂暴几率",mount.getMountid())[1]);
					inster(ql,"抗水法狂暴", (Double) PetAddPointMouslisten.value("抗仙法鬼火狂暴几率",mount.getMountid())[1]);
					inster(ql,"抗雷法狂暴", (Double) PetAddPointMouslisten.value("抗仙法鬼火狂暴几率",mount.getMountid())[1]);
					inster(ql,"抗鬼火狂暴", (Double) PetAddPointMouslisten.value("抗仙法鬼火狂暴几率",mount.getMountid())[1]);
					inster(ql,"物理吸收率", (Double) PetAddPointMouslisten.value("物理吸收率",mount.getMountid())[1]);
					inster(ql,"法术躲闪", (Double) PetAddPointMouslisten.value("法术躲闪几率",mount.getMountid())[1]);
					inster(ql,"忽视抗风", (Double) PetAddPointMouslisten.value("忽视抗仙法鬼火",mount.getMountid())[1]);
					inster(ql,"忽视抗雷", (Double) PetAddPointMouslisten.value("忽视抗仙法鬼火",mount.getMountid())[1]);
					inster(ql,"忽视抗水", (Double) PetAddPointMouslisten.value("忽视抗仙法鬼火",mount.getMountid())[1]);
					inster(ql,"忽视抗火", (Double) PetAddPointMouslisten.value("忽视抗仙法鬼火",mount.getMountid())[1]);
					inster(ql,"忽视抗鬼火", (Double) PetAddPointMouslisten.value("忽视抗仙法鬼火",mount.getMountid())[1]);
					if (mount.getShouhu()!=0){
						Ql finalQl = ql;
						ShouhuPackJframe.getShouhuPackJframe().getShouhuPackJpanel().Eqment.forEach(P->{
							if (P.getRgid().intValue()==mount.getShouhu()){
								if (P.getValue()!=null&&!P.getValue().equals("")){
									String mes[]=P.getValue().split("\\|");
									for (int d=1;d<=mes.length-1;d++){
										if (mes[d].split("=")[0].contains("气血")||mes[d].split("=")[0].contains("魔法")||mes[d].split("=")[0].contains("速度")||mes[d].split("=")[0].contains("攻击")){

										}else {
											if(mes[d].split("=").length==2)
												inster(finalQl,mes[d].split("=")[0], Double.parseDouble(mes[d].split("=")[1]));
										}
									}
								}
							}
						});
					}
					List<MountSkill> mountSkills=mount.getMountskill();
					if (mountSkills!=null) {
						for (int j = 0; j < mountSkills.size(); j++) {
							String mountStrings[] =Util.calculateAddition(mount,mountSkills.get(j).getSkillname()).split("\\|");
							for (int k = 0; k < mountStrings.length; k++) {
								String[] vs=mountStrings[k].split("=");
								double value=Double.parseDouble(vs[1]);
								if ("HP".equals(vs[0])|| "MP".equals(vs[0])|| "AP".equals(vs[0])|| "SP".equals(vs[0])) {
									continue;
								}else if ("风法伤害".equals(vs[0])|| "水法伤害".equals(vs[0])|| "火法伤害".equals(vs[0])|| "雷法伤害".equals(vs[0])) {
									value=value*10000;
								}else if(!(vs[0].indexOf("次数")!=-1||vs[0].indexOf("三尸")!=-1)){
									value=value*100;
								}
								QualityZW.insertValues(ql,vs[0],value);
							}
						}
					}
					break;
				}
			}
			if (pet.getInnerGoods()!=null&&!"".equals(pet.getInnerGoods())) {
				String[] vv=pet.getInnerGoods().split("\\|");
				for (int i = 0; i < vv.length; i++) {
					Goodstable goodstable=GoodsListFromServerUntil.fushis.get(new BigDecimal(vv[i]));
					if (goodstable!=null){
						String goodname=goodstable.getGoodsname();
						boolean type=("红颜白发".equals(goodname)|| "梅花三弄".equals(goodname)|| "开天辟地".equals(goodname)|| "万佛朝宗".equals(goodname)|| "暗渡陈仓".equals(goodname)|| "借力打力".equals(goodname)|| "凌波微步".equals(goodname));
						if (!type) {continue;}
						String[] strings = goodstable.getValue().split("\\|");
						String[] stringLevel = strings[2].split("\\=");
						String[] stringLevel2 = stringLevel[1].split("\\转");
						int nddj = Integer.parseInt(stringLevel2[1]);//内丹等级
						int ndzscs = Integer.parseInt(stringLevel2[0]);;//内丹转生次数
						if (type) {
							addNedanMsg(pet, ql, nddj, ndzscs, goodname);
						}
					}
				}
			}
			//炼妖属性
			if (pet.getLyk()!=null&&!"".equals(pet.getLyk())) {
				String[] v=pet.getLyk().split("\\|");
				for (int i = 0; i < v.length; i++) {
					String[] v1=v[i].split("=");
					QualityZW.insertValues(ql, v1[0],Double.parseDouble(v1[1]));
				}
			}
			//技能属性
			addQlSkill(ql, pet.getSkill(),pet.getFriendliness());
			addQlSkill(ql, pet.getPetSkills(),pet.getFriendliness());
			addQlSkill(ql, pet.getBeastSkills(),pet.getFriendliness());
			if (pet.getFriendliness()>100000) {
				QualityZW.insertValues(ql, "连击率",5+CustomFunction.XS(pet.getFriendliness(), 0.7));
				QualityZW.insertValues(ql, "连击次数",(int)(3+CustomFunction.XS(pet.getFriendliness(), 0.2)));
				QualityZW.insertValues(ql, "命中率",2+CustomFunction.XS(pet.getFriendliness(), 0.4));
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

		ql.addKUp(up);
		ql.addKKUp(up+(pet.getTurnRount()>=4?10:0));

		// 灵犀额外控制抗性
		int kx = LingXiUtil.getNumberByStr(pet.getLingxi(), "11005", 1);
		if (kx > 0) {
			QualityZW.insertValues(ql,"抗混乱",kx);
			QualityZW.insertValues(ql,"抗封印",kx);
			QualityZW.insertValues(ql,"抗昏睡",kx);
			QualityZW.insertValues(ql,"抗遗忘",kx);
		}

		//抗性五行调整
		if (ql.getRolewxj()!=0||ql.getRolewxm()!=0||ql.getRolewxt()!=0||ql.getRolewxs()!=0||ql.getRolewxh()!=0) {
			QualityZW.insertValues(ql, "金",Double.parseDouble(pet.getGold())/2);
			QualityZW.insertValues(ql, "木",Double.parseDouble(pet.getWood())/2);
			QualityZW.insertValues(ql, "土",Double.parseDouble(pet.getSoil())/2);
			QualityZW.insertValues(ql, "水",Double.parseDouble(pet.getWater())/2);
			QualityZW.insertValues(ql, "火",Double.parseDouble(pet.getFire())/2);
		}else {
			QualityZW.insertValues(ql, "金",Double.parseDouble(pet.getGold()));
			QualityZW.insertValues(ql, "木",Double.parseDouble(pet.getWood()));
			QualityZW.insertValues(ql, "土",Double.parseDouble(pet.getSoil()));
			QualityZW.insertValues(ql, "水",Double.parseDouble(pet.getWater()));
			QualityZW.insertValues(ql, "火",Double.parseDouble(pet.getFire()));
		}
		ql.setRolewxj((int)ql.getRolewxj());
		ql.setRolewxm((int)ql.getRolewxm());
		ql.setRolewxt((int)ql.getRolewxt());
		ql.setRolewxs((int)ql.getRolewxs());
		ql.setRolewxh((int)ql.getRolewxh());
		return ql;
	}
	/**根据技能id添加*/
	public static void addQlSkill(Ql ql,String skill,long qm){
		if (skill==null|| "".equals(skill)) {
			return;
		}
		double value;
		String[] v = skill.split("\\|");
		for (int i = 0; i < v.length; i++) {
			switch (v[i]) {
				case "1810":
					value=5+CustomFunction.XS(qm, 0.3);
					QualityZW.insertValues(ql, "抗风",-value);
					QualityZW.insertValues(ql, "抗火",-value);
					QualityZW.insertValues(ql, "抗水",-value);
					QualityZW.insertValues(ql, "抗雷",-value);
					QualityZW.insertValues(ql, "抗鬼火",-value);
					QualityZW.insertValues(ql, "反震率",value);
					QualityZW.insertValues(ql, "反震程度",value);
					break;
				case "1811":
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "抗风",-value);
					QualityZW.insertValues(ql, "抗火",-value);
					QualityZW.insertValues(ql, "抗水",-value);
					QualityZW.insertValues(ql, "抗雷",-value);
					QualityZW.insertValues(ql, "抗鬼火",-value);
					QualityZW.insertValues(ql, "反震率",value);
					QualityZW.insertValues(ql, "反震程度",value);
					break;
				case "1813":
				case "1820":
				case "1821":
				case "1822":
				case "1823":
				case "1824":
					value=2+CustomFunction.XS(qm, 0.2);
					QualityZW.insertValues(ql, "抗封印",value);
					QualityZW.insertValues(ql, "抗混乱",value);
					QualityZW.insertValues(ql, "抗遗忘",value);
					break;
				case "1815":
					value=2+CustomFunction.XS(qm, 0.2);
					QualityZW.insertValues(ql, "金",50);
					QualityZW.insertValues(ql, "抗封印",value);
					QualityZW.insertValues(ql, "抗混乱",value);
					QualityZW.insertValues(ql, "抗遗忘",value);
					break;
				case "1816":
					value=2+CustomFunction.XS(qm, 0.2);
					QualityZW.insertValues(ql, "木",50);
					QualityZW.insertValues(ql, "抗封印",value);
					QualityZW.insertValues(ql, "抗混乱",value);
					QualityZW.insertValues(ql, "抗遗忘",value);
					break;
				case "1817":
					value=2+CustomFunction.XS(qm, 0.2);
					QualityZW.insertValues(ql, "水",50);
					QualityZW.insertValues(ql, "抗封印",value);
					QualityZW.insertValues(ql, "抗混乱",value);
					QualityZW.insertValues(ql, "抗遗忘",value);
					break;
				case "1818":

					value=2+CustomFunction.XS(qm, 0.2);
					QualityZW.insertValues(ql, "火",50);
					QualityZW.insertValues(ql, "抗封印",value);
					QualityZW.insertValues(ql, "抗混乱",value);
					QualityZW.insertValues(ql, "抗遗忘",value);
					break;
				case "1819":
					value=2+CustomFunction.XS(qm, 0.2);
					QualityZW.insertValues(ql, "土",50);
					QualityZW.insertValues(ql, "抗封印",value);
					QualityZW.insertValues(ql, "抗混乱",value);
					QualityZW.insertValues(ql, "抗遗忘",value);
					break;
				case "1207":
					value=3+CustomFunction.XS(qm, 0.2);
					QualityZW.insertValues(ql, "连击率",value);
					break;
				case "1208":
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "忽视防御几率",value);
					QualityZW.insertValues(ql, "忽视防御程度",value);
					break;
				case "1209":
					value=5+CustomFunction.XS(qm, 0.3);
					QualityZW.insertValues(ql, "狂暴率",value);
					QualityZW.insertValues(ql, "致命率",value);
					break;
				case "1213":
					value=5+CustomFunction.XS(qm, 0.3);
					QualityZW.insertValues(ql, "反震率",value);
					QualityZW.insertValues(ql, "反震程度",value);
					break;
				case "1214":
					value=5+CustomFunction.XS(qm, 0.4);
					QualityZW.insertValues(ql, "狂暴率",value);
					QualityZW.insertValues(ql, "致命率",value);
					QualityZW.insertValues(ql, "命中率",value);
					break;
				case "1222":
					value=5+CustomFunction.XS(qm, 0.4);
					QualityZW.insertValues(ql, "抗震慑",value);
					break;
				case "1226":
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "物理吸收",value);
					break;
				case "1845":
					value=5+CustomFunction.XS(qm, 0.5);
					QualityZW.insertValues(ql, "附加封印攻击",value);
					break;
				case "1846":
					value=5+CustomFunction.XS(qm, 0.5);
					QualityZW.insertValues(ql, "附加混乱攻击",value);
					break;
				case "1855":
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "抗致命率",value);
					break;
				case "1856":
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "仙法狂暴",value);
					break;
				case "1857":
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "忽视仙法",value);
					break;
				case "1859":
					value=3+CustomFunction.XS(qm, 0.3);
					QualityZW.insertValues(ql, "抗封印",value);
					QualityZW.insertValues(ql, "抗混乱",value);
					QualityZW.insertValues(ql, "抗遗忘",value);
					break;
				case "1860":
					value=5+CustomFunction.XS(qm, 0.5);
					QualityZW.insertValues(ql, "附加三尸攻击",value);
					break;
				case "1886":
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "忽视仙法",value);
					value=10+CustomFunction.XS(qm, 0.6);
					QualityZW.insertValues(ql, "仙法狂暴",value);
					break;
			}
		}
	}
	//抗性型内丹加抗性方法
	public static void addNedanMsg(RoleSummoning roleSummoning,Ql ql,int nddj,int ndzscs,String goodsname){
		int zhsdj = AnalysisString.petLvlint(roleSummoning.getGrade());//召唤兽等级
		int zhszscs = roleSummoning.getTurnRount();//召唤兽转生次数
		long zhsqm = roleSummoning.getFriendliness();//召唤兽亲密值
		if("暗渡陈仓".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			QualityZW.insertValues(ql,"忽视躲闪",Math.round(ndjl*10000)/100D);
			QualityZW.insertValues(ql,"忽视反击",Math.round(ndjl*10000)/100D);
		}else if("凌波微步".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.00001;
			QualityZW.insertValues(ql,"躲闪率",Math.round(ndjl*10000)/100D);
		}else if("借力打力".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.00001;
			int ndcd_jldl=nd_jldl_fjcs(ndjl);
			QualityZW.insertValues(ql,"反击率",Math.round(ndjl*10000)/100D);
			QualityZW.insertValues(ql,"反击次数",ndcd_jldl);
		}else if("梅花三弄".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			int ndcd_jldl=nd_mhsn_ljcs(ndjl);
			QualityZW.insertValues(ql,"仙法连击率",Math.round(ndjl*10000)/100D);
			QualityZW.insertValues(ql,"仙法连击次数",ndcd_jldl);
		}else if("红颜白发".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			QualityZW.insertValues(ql,"仙法狂暴",Math.round(ndjl*10000)/100D);
		}else if("开天辟地".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			QualityZW.insertValues(ql,"忽视仙法抗性率",Math.round(ndjl*10000)/100D);
			QualityZW.insertValues(ql,"忽视仙法抗性程度",Math.round(ndjl*10000)/100D);
		}else if("万佛朝宗".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			double ndcd=ndjl*2;
			if (roleSummoning.getPetSkills()!=null && roleSummoning.getPetSkills().contains("1247")) {
				QualityZW.insertValues(ql,"反震率",Math.round(ndjl*10100)/100D);
				QualityZW.insertValues(ql,"反震程度",Math.round(ndcd*10100)/100D);
			}else {
				QualityZW.insertValues(ql,"反震率",Math.round(ndjl*10000)/100D);
				QualityZW.insertValues(ql,"反震程度",Math.round(ndcd*10000)/100D);
			}
		}
	}
	//	//非抗性型内丹获取几率、伤害率的方法
	public static String NedanMsg(RoleSummoning roleSummoning,int nddj,int ndzscs,String goodsname,int zhsmpz){
		zhsmpz+=100;
		String NdMsg = null;
		int zhsdj = AnalysisString.petLvlint(roleSummoning.getGrade());//召唤兽等级
		int zhszscs = roleSummoning.getTurnRount();//召唤兽转生次数
		long zhsqm = roleSummoning.getFriendliness();//召唤兽亲密值
		if("暗渡陈仓".equals(goodsname)) {
			double ndjl = Math.floor((Math.pow(zhsdj * nddj * 0.04, 1.0 / 2.0) * (1 + 0.25 * ndzscs) + Math.pow(zhsqm, 1.0 / 6.0) * xstz(zhszscs, ndzscs) * nddj / 50) * 1000) * 0.000005;
			NdMsg = "物理攻击的时能够忽视目标" + Math.round(ndjl * 1000) / 10D + "%躲闪率和" + Math.round(ndjl * 1000) / 10D + "%反击率。";
		}else if("隔山打牛".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			double ndcd=Math.floor((zhsdj*zhsdj*0.2/(zhsmpz*1+1)+ndjl*3)*1000)/1000;
			NdMsg = "物理攻击的时候有"+Math.round((ndjl*1000)*0.7)/10D+"%几率对攻击对象之外随机目标造成" + Math.round((ndcd*1000)*0.7)/10D + "%的伤害。";
		}else if("浩然正气".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			double ndcd=Math.floor((zhsdj*zhsdj*0.2/(zhsmpz*1+1)+ndjl)*1000)/1000;
			NdMsg = "物理攻击时有"+Math.round(ndjl*1000)/10D+"%几率对目标造成目标法力值" + Math.round(ndcd*1000)/10D + "的伤害。";
		}else if("凌波微步".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.00001;
			NdMsg = "提高召唤兽。"+Math.round(ndjl*1000)/10D+"%的躲闪率";
		}else if("借力打力".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.00001;
			int ndcd_jldl=nd_jldl_fjcs(ndjl);
			NdMsg = "在受到物理攻击的一回合内有"+Math.round(ndjl*1000)/10D+"%的几率产生反击效果,反击次数为"+ndcd_jldl+"次";
		}else if("梅花三弄".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			int ndcd_jldl=nd_mhsn_ljcs(ndjl);
			NdMsg = "使用单体仙法攻击的时"+Math.round(ndjl*1000)/10D+"%的几率出现法术连击,法术连击次数为"+ndcd_jldl+"次";
		}else if("红颜白发".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			NdMsg = "召唤兽使用仙法攻击时，有"+Math.round(ndjl*1000)/10D+"%几率出现仙法狂暴";
		}else if("开天辟地".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			NdMsg = "召唤兽使用仙法攻击时，有"+Math.round(ndjl*1000)/10D+"%几率忽视目标的法术抗性";
		}else if("万佛朝宗".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000005;
			double ndcd=ndjl*2;
			NdMsg = "召唤兽被对方攻击时，有"+Math.round(ndjl*1000)/10D+"%几率产生" + Math.round(ndcd*1000)/10D + "%反震效果";
		}else if("天魔解体".equals(goodsname)){
			double ndjl = 0;
			if(zhszscs==0) {
				ndjl=Math.floor((Math.pow(zhsdj*nddj/160000.0,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*nddj/4000)*1000)/1000+0.01;
			} else {
				ndjl=Math.floor((Math.pow(zhsdj*nddj/160000.0,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*nddj/3755)*1000)/1000+0.01;
			}
			double ndhq=Math.floor(ndjl*(zhsdj*zhsdj*0.15/(zhsmpz*1+0.01)+0.2)*1000)/1000;
			if (ndjl > 0.9){ndjl = 0.9;}
			NdMsg = "召唤兽通过牺牲自己的"+Math.round(ndjl*10000)/100D+"%HP给对手造成" + Math.round(ndhq*1000)/10D  + "%HP伤害";
		}else if("分光化影".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj/160000.0,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*nddj/4000)*1000)/1000+0.01;
			double ndhq=Math.floor(ndjl*(zhsdj*zhsdj*0.15/(zhsmpz*1+0.01)+0.2)*1000)/1000;
			if (ndjl > 0.9){ndjl = 0.9;}
			NdMsg = "召唤兽通过牺牲自己的"+Math.round(ndjl*10000)/100D+"%HP给对手造成" + Math.round(ndhq*1000)/10D + "%MP伤害";
		}else if("小楼夜哭".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj/206600.0,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*nddj/4170)*1000)/1000+0.01;
			double ndhq=ndjl*0.3;
			if (ndjl > 0.9){ndjl = 0.9;}
			NdMsg = "召唤兽通过牺牲自己的"+Math.round(ndjl*10000)/100D+"%MP给对手造成" + Math.round(ndhq*1000)/10D + "%MP伤害";
		}else if("青面獠牙".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj/698000.0,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*nddj/7500)*1000)/1000+0.01;
			double ndhq=ndjl*0.7;
			ndjl *= 2;
			if (ndjl > 0.9){ndjl = 0.9;}
			NdMsg = "召唤兽通过牺牲自己的"+Math.round(ndjl*10000)/100D+"%MP给对手造成" + Math.round(ndhq*1000)/10D  + "%HP伤害";
		}else if("大海无量".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000004;
			double ndcd=Math.floor(296.1572+0.0002364957*Math.pow(zhsmpz,1.57));
			NdMsg = "召唤兽物理攻击时，有"+Math.round(ndjl*10000)/100D+"%几率产生水系法术伤害";
		}else if("乘风破浪".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000004;
			double ndcd=Math.floor(296.1572+0.0002364957*Math.pow(zhsmpz,1.57));
			NdMsg = "召唤兽物理攻击时，有"+Math.round(ndjl*10000)/100D+"%几率产生风系法术伤害";
		}else if("霹雳流星".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000004;
			double ndcd=Math.floor(296.1572+0.0002364957*Math.pow(zhsmpz,1.57));
			NdMsg = "召唤兽物理攻击时，有"+Math.round(ndjl*10000)/100D+"%几率产生雷系法术伤害";
		}else if("祝融取火".equals(goodsname)){
			double ndjl=Math.floor((Math.pow(zhsdj*nddj*0.04,1.0/2.0)*(1+0.25*ndzscs)+Math.pow(zhsqm,1.0/6.0)*xstz(zhszscs,ndzscs)*nddj/50)*1000)*0.000004;
			double ndcd=Math.floor(296.1572+0.0002364957*Math.pow(zhsmpz,1.57));
			NdMsg = "召唤兽物理攻击时，有"+Math.round(ndjl*10000)/100D+"%几率产生火系法术伤害";
		}
		return NdMsg;
	}
	//获得转生系数的方法
	public static double xstz(int zhs_zscs,int nd_zscs){
		if(zhs_zscs*nd_zscs==1) {
			return 1.04;
		} else if(zhs_zscs*nd_zscs==4) {
			return 1.071;
		} else if(zhs_zscs*nd_zscs==6) {
			return 1.073;
		} else if(zhs_zscs*nd_zscs==9) {
			return 1.09;
		} else {
			return 1;
		}
	}
	//获得反击次数的方法
	public static int nd_jldl_fjcs(double jl){
		if(jl>0.56) {
			return 10;
		} else if(jl>0.51) {
			return 8;
		} else if(jl>0.45) {
			return 7;
		} else if(jl>0.39) {
			return 6;
		} else if(jl>0.32) {
			return 5;
		} else if(jl>0.25) {
			return 4;
		} else if(jl>0.17) {
			return 3;
		} else if(jl>0.09) {
			return 2;
		} else {
			return 1;
		}
	}
	//获得连击次数的方法
	public static int nd_mhsn_ljcs(double mhsn){
		if(mhsn>0.28) {
			return 5;
		} else if(mhsn>0.21) {
			return 4;
		} else if(mhsn>0.14) {
			return 3;
		} else if(mhsn>0.7) {
			return 2;
		} else {
			return 1;
		}
	}
	public static void  inster(Ql ql,String v,double value2){
		QualityZW.insertValues(ql, v, value2);
	}
}
